/**
 * 文件名称:ParasolAction.java
 * 文件版权:ChinaParasol Technologies Co., Ltd. Copyright 1998-2020, All rights reserved
 * 文件描述:<描述>
 * 修改作者:LiXiangDong
 * 修改时间:Dec 31, 2012
 */
package com.parasol.hcerp.common.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 
 * @author  LiXiangDong
 * @version V1.0
 */
public class ParasolAction extends ActionSupport
{
    
    /**
     * 注释内容
     */
    private static final long serialVersionUID = 2731724057159236731L;
    
    /**
     * 获取request对象
     * @return HttpServletRequest Request对象
     */
    public HttpServletRequest getRequest()
    {
        HttpServletRequest request = ServletActionContext.getRequest();
        return request;
    }
    
    /**
     * 获取response对象
     * @return HttpServletResponse Response对象
     */
    public HttpServletResponse getResponse()
    {
        HttpServletResponse response = ServletActionContext.getResponse();
        return response;
    }
    
    /**
     * 获取Session对象
     * @return HttpSession Session对象
     */
    public HttpSession getSession()
    {
        HttpSession session = getRequest().getSession();
        return session;
    }
    
    /**
     * 获取输出对象
     * @return PrintWriter 输出对象
     * @throws IOException IO异常
     */
    public PrintWriter getPrintWrite() throws IOException
    {
        getResponse().setContentType("text/html;charset=utf-8");
        return getResponse().getWriter();
    }
    
    public void clientCache()
    {
        HttpServletResponse response = this.getResponse();
        //清除登陆页面缓存   
        response.setHeader("Pragma", "No-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setHeader("Cache-Control", "no-store");
        response.setDateHeader("Expires", 0);
    }
}
